/**
 * losenote.com Inc.
 * Copyright (c) 2013-2013 All Rights Reserved.
 */
package com.losenote.web.control;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.losenote.service.QuestionService;
import com.losenote.service.result.AnswerResult;
import com.losenote.web.ct.AnswerReqCt;
import com.losenote.web.form.AnswerForm;

/**
 * 问题信息校验处理器
 * 
 * @author danjingyu
 * @version $Id: QuestionValidController.java, v 0.1 2013-11-1 上午7:59:28 danjingyu Exp $
 */
@Controller
public class QuestionValidController {

    @Autowired
    private QuestionService questionService;

    /**
     * @param httpservletrequest
     * @param modelMap
     * @return
     */
    @RequestMapping("answerForContact.json")
    @ResponseBody
    public Object handleRequest(HttpServletRequest httpservletrequest, AnswerForm answerForm) {
        AnswerResult answer = questionService.validQuestion(AnswerReqCt.fromForm(answerForm));
        return answer;
    }

    public void setQuestionService(QuestionService questionService) {
        this.questionService = questionService;
    }

}
